<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>微博发布效果</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        .weibo {
            width: 600px;
            border: 1px solid #ccc;

            margin: 100px auto;
            padding: 10px;

        }

        .weibo-text {
            width: 590px;
            height: 140px;
            padding: 5px;
            border: 1px solid #ccc;
            outline: none;
            resize: none;
        }

        .weibo-text:focus {
            border-color: #f60;
        }

        .weibo-btn {
            width: 80px;
            height: 30px;
            background-color: #f90;
            color: #fff;
            border: 0 none;
            margin-top: 5px;
            border-radius: 3px;
            cursor: pointer;
            outline: 0 none;
        }

        .weibo-list {
            padding-top: 10px;
        }

        .weibo-list li {
            font-size: 14px;
            line-height: 30px;
            border-bottom: 1px dotted #ccc;
            overflow: hidden;
        }

        .weibo-list li p {
            float: left;
        }

        .weibo-list li span {
            float: right;
            cursor: pointer;
        }

        .weibo-list li input {
            height: 24px;
            line-height: 24px;
            width: 300px;
            font-size: 14px;
            border: 0 none;
        }
    </style>    
</head>

<body>
<div class="weibo">
    <textarea class="weibo-text"></textarea>
    <input class="weibo-btn" value="发布" type="button">
    <ul class="weibo-list">
        <li>
            <p>快来收了这九款用上就停不下来的应用吧！！</p>
            <span>删除</span>
        </li>
        <li>
            <p>超级详细的云南大理自助游攻略</p>
            <span>删除</span>
        </li>
        <li>
            <p>外国最近很火的舞蹈，舒服简单自然，太棒了！</p>
            <span>删除</span>
        </li>
    </ul>
</div>
</body>
<script>
var fabu=document.querySelector('.weibo-btn');
var text=document.querySelector('.weibo-text');
var list=document.querySelector('.weibo-list');
// 首先要注册点击发布事件
fabu.onclick=function(){
  // 获取文本内容
var content=text.value;
text.value='';
// 获取时间
// var time=formData();
// 手动创建元素
var li=document.createElement('li');
// 添加标签结构
li.innerHTML='<p>'+content+'</p>'+'<span>删除</span>';
// 插入ul的第一个孩子
list.insertBefore(li,list.children[0]);




}
</script>
</html>
